<template>
  <!-- 患者自带报告 -->
  <section>
    <el-tabs v-if="tableList.length >0" v-model="tabName" type="border-card">
      <template v-for="(item,index) in tableList">
        <el-tab-pane :key="index" :name="'t'+index">
          <template v-slot:label>
            <div class="title-report overflow-omit">{{item.name}}</div>
          </template>
          <div style="margin-bottom:15px;">报告时间：{{item.reportTime}}</div>
          <div style="margin-bottom:15px;">报告影像：</div>
          <div v-for="(item,index) in item.imgUrls" :key="index">
            <!-- <el-image class="report-image" fit="cover" :src="item" :preview-src-list="imgUrl"></el-image> -->
            <el-link type="primary" @click="onOpenUrl(item)">{{item}}</el-link>
          </div>
          <div style="margin-top:15px;">结论：{{item.result}}</div>
        </el-tab-pane>
      </template>
    </el-tabs>
    <div v-if="tableList.length == 0" style="color:#999;padding:10px 0;text-align:center;">
      <i class="iconfont iconwushuju" style="font-size:40px;"></i>
      <div>暂无数据</div>
    </div>
  </section>
</template>
<script>
export default {
  props: ["cureId"],
  data() {
    return {
      tableList: [],
      tabName: "t0"
    };
  },
  mounted() {
    const th = this;
    th.getData();
  },
  methods: {
    getData() {
      const th = this;
      let j = {
        cureId: th.cureId
      };
      th.$api.getPatientReportById(j).then(res => {
        if (res.executed) {
          th.tableList = res.data || [];
        }
      });
    },
    onOpenUrl(url) {
      window.open(this.$config.imageUrl + url);
    }
  }
};
</script>